<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <!-- 默认效果：按照标签书写顺序，后来者居上 -->
    <!-- 作用：设置定位元素的层级顺序，改变定位元素的现实顺序 -->
    <style>
        div{
            position: absolute;
            width: 200px;
            height: 200px;
        }

        .box1{
            background-color: pink;
            z-index: 1;
        }

        .box2{
            background-color: skyblue;
            left: 100px;
            top: 100px;
            z-index: 2;
        }
    </style>
</head>
<body>
    <div class="box1">box1</div>
    <div class="box2">box2</div>
</body>
</html>